POV-Ray : Newsgroups : povray.newusers : Staircases : Re: Staircases Server Time
5 Nov 2024 16:38:45 EST (-0500)
  Re: Staircases  
From: Chris B
Date: 15 Apr 2005 10:31:57
Message: <425fd05d$1@news.povray.org>
"Ranj" <nomail@nomail> wrote in message
news:web.425be4b2825a36abc40f76ea0@news.povray.org...
> Hi, does anyone know a shortcut or macro for building spiral staircases?
> Thanx
>

Hi Ranj,

You just need to define your step, then use a while loop to position a bunch
of copies of it in a spiral.
Here's a very simple example:

//  Spiral Staircase

#include "colors.inc"
#include "stones.inc"

camera {location <-2, 5, -2> look_at  <0, 3,  0>}
light_source { <0, 50, -10> color White}
light_source { <-100, 5, -10> color White}

#declare StepArc       = 20;
#declare StepHeight    =  0.075;
#declare StepRise      =  0.15;
#declare StepWidth     =  1;
#declare NumberOfSteps = 45;

#declare Step = difference {
  cylinder {0,StepHeight*y,1}
  plane {-z,0}
  plane { z,0 rotate StepArc*y}
}
#declare Rail = union {
  cylinder {0,y,0.01 translate <StepWidth*0.95,StepHeight,0> rotate
0.5*StepArc*y}
  sphere   {y,0.02   translate <StepWidth*0.95,StepHeight,0> rotate
0.5*StepArc*y}
  pigment  {color Gold}
}

#local i=0;
#while (i<NumberOfSteps)
  object {Step
    rotate -i*StepArc*y
    translate i*StepRise*y
    texture {T_Stone1 scale 0.05 rotate 2*i*StepArc*y}
  }
  object {Rail
    rotate -i*StepArc*y
    translate i*StepRise*y
  }
  #local i = i + 1;
#end


Chris B.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.